package com.ithuameng.admin.app.system.model;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * Job 日志
 *
 * @author ithuameng
 */
@Data
@TableName("t_sys_job_log")
@EqualsAndHashCode(callSuper = false)
public class SysJobLog {

    private static final long serialVersionUID = -1892811287316609152L;

    public static final String JOB_ID = "job_id";

    public static final String JOB_NAME = "job_name";

    public static final String PARAMETER = "parameter";

    public static final String STATUS = "status";

    public static final String EXCEPTION_MESSAGE = "exception_message";

    public static final String EXECUTE_TIME = "execute_time";

    public static final String END_TIME = "end_time";

    public static final String CREATE_TIME = "create_time";

    /**
     * Job log id
     */
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    /**
     * 任务编号
     */
    private String jobId;

    /**
     * 任务名称
     */
    private String jobName;

    /**
     * 参数
     */
    private String parameter;

    /**
     * 执行状态
     */
    private String status;

    /**
     * 异常信息
     */
    private String exceptionMessage;

    /**
     * 执行时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime executeTime;

    /**
     * 结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime endTime;

    /**
     * 创建时间
     */
    @TableField(value = CREATE_TIME, fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    public SysJobLog() {
        super();
    }

    public SysJobLog(String jobId, String jobName, String parameter, LocalDateTime executeTime, LocalDateTime endTime) {
        super();
        this.jobId = jobId;
        this.jobName = jobName;
        this.parameter = parameter;
        this.executeTime = executeTime;
        this.endTime = endTime;
    }
}
